//
//  ArticleCollectionViewCell.m
//  OneDay
//
//  Created by lanou3g on 15/10/31.
//  Copyright © 2015年 oneDay. All rights reserved.
//

#import "ArticleCollectionViewCell.h"

@implementation ArticleCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self layOut];
    }
    return self;
}

- (void)layOut
{
    CGFloat kw = self.frame.size.width;
    CGFloat kh = self.frame.size.height;
    self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    self.bgImageView.layer.cornerRadius = self.bgImageView.frame.size.width / 15;
    self.bgImageView.layer.masksToBounds = YES;
    self.bgImageView.backgroundColor = [UIColor greenColor];
    [self addSubview:self.bgImageView];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.016 * kw, 0.1 * kh, self.frame.size.width - 10, 0.1 * kh)];
    self.titleLabel.backgroundColor = [UIColor clearColor];
    self.titleLabel.numberOfLines = 0;
    [self addSubview:self.titleLabel];
    
    self.summaryLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.016 * kw, self.frame.size.height - 0.3 * kh, self.frame.size.width - 0.03 * kw, 0.3 * kh)];
    self.summaryLabel.backgroundColor = [UIColor clearColor];
    self.summaryLabel.font = [UIFont systemFontOfSize:14];
    self.summaryLabel.numberOfLines = 0;
    [self addSubview:self.summaryLabel];
    
}

- (void)setModel:(ArticleModel *)model
{
    self.titleLabel.text = [NSString stringWithFormat:@"%@", model.title];
    self.summaryLabel.text = [NSString stringWithFormat:@"%@", model.summary];
}




@end
